package com.b511.swpu.cementbackend.repository;

import com.b511.swpu.cementbackend.entity.Borehole;
import com.b511.swpu.cementbackend.entity.MetaSystemUnitValue;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface MetaSystemUnitValueRepository extends JpaRepository<MetaSystemUnitValue, String> {

    List<MetaSystemUnitValue> findByMetaSystemUnit_Id(Long id);

    @Query(value = "UPDATE META_SYSTEM_UNIT_VALUE SET UNIT_CATEGORY_VALUE_ID=:unitCategoryValueId WHERE ID=:metaSystemUnitId", nativeQuery = true)
    @Modifying
    Integer updateMetaSystemUnitValue(@Param("metaSystemUnitId") Long id, @Param("unitCategoryValueId") Long unitCategoryValueId);
}
